import request from '/@/utils/request'
import {prefix} from './index'

export default {
  /**
   * 获取历史填写的产品列表
   */
  getHistoryProducts() {
    return request({
      url: prefix + '/purchaseOrder/getProducts',
      method: 'get'
    })
  },
  /**
   * 采购单分页数据
   */
  getOrderPage(data) {
    return request({
      url: prefix + '/purchaseOrder/getPage',
      method: 'post',
      data
    })
  },
  /**
   * 获取数据统计
   */
  getMonthCal() {
    return request({
      url: prefix + '/purchaseOrder/getMonthData',
      method: 'get'
    })
  },
  /**
   * 获取阶段统计数据
   */
  getStageData() {
    return request({
      url: prefix + '/purchaseOrder/getStageData',
      method: 'get'
    })
  },
  /**
   * 保存草稿
   */
  saveDraft(data) {
    return request({
      url: prefix + '/purchaseOrder/saveDraft',
      method: 'post',
      data
    })
  },
  /**
   * 保存采购单
   */
  createOrder(data) {
    return request({
      url: prefix + '/purchaseOrder/create',
      method: 'post',
      data
    })
  },
  /**
   * 删除草稿
   */
  removeDraft(data) {
    return request({
      url: prefix + '/purchaseOrder/deleteDraft',
      method: 'post',
      data
    })
  },
  /**
   * 编辑采购单
   */
  editOrder(data) {
    return request({
      url: prefix + '/purchaseOrder/edit',
      method: 'post',
      data
    })
  },
  /**
   * 获取订单阶段记录
   */
  getStageRecord(orderId) {
    return request({
      url: prefix + '/purchaseOrder/getStageRecord?orderId=' + orderId,
      method: 'get'
    })
  },
  /**
   * 修改阶段
   */
  modifyStage(data) {
    return request({
      url: prefix + '/purchaseOrder/modifyStage',
      method: 'post',
      data
    })
  },
  /**
   * 取消订单
   */
  cancelOrder(data) {
    return request({
      url: prefix + '/purchaseOrder/cancelOrder',
      method: 'post',
      data
    })
  },
  /**
   * 获取表头数据
   */
  getHeaders(type) {
    return request({
      url: prefix + '/purchaseOrder/getHeaders?type=' + type,
      method: 'get'
    })
  },
  /**
   * 表头保存
   */
  saveHeader(type, data) {
    return request({
      url: prefix + '/purchaseOrder/saveHeader/' + type,
      method: 'post',
      data
    })
  },
  /**
   * 直发
   */
  purchaseSend(data) {
    return request({
      url: prefix + '/purchaseOrder/sendPurchase',
      method: 'post',
      data
    })
  },
  /**
   * 根据供应商信息ID获取对应的采购单列表数据-阶段数据 只查询最新5条
   */
  getPurchaseOrderPageBySupplierInfoId(data){
    return request({
      url: prefix + '/purchaseOrder/getPurchaseOrderPageBySupplierInfoId',
      method: 'post',
      data
    })
  },
  /**
   * 新调整的采购单分页接口
   */
  newlyOrderPage(data) {
    return request({
      url: prefix + '/purchaseOrder/getOrderPage',
      method: 'post',
      data
    })
  },
  /**
   * 获取审批签署单阶段数据
   */
  getApproveSignStageData() {
    return request({
      url: prefix + '/purchaseOrder/getApproveSignStageData',
      method: 'get'
    })
  },
  /**
   * 生效单的各统计数据
   */
  getValidCountData() {
    return request({
      url: prefix + '/purchaseOrder/getValidStageData',
      method: 'get'
    })
  },
  /**
   * 采购单生效
   */
  validOrder(data) {
    return request({
      url: prefix + '/purchaseOrder/validOrder',
      method: 'post',
      data
    })
  }
}










